package com.example.water_quality_analysis.pojo.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 *
 * @TableName data
 */
@AllArgsConstructor
@Setter
@Getter
@TableName(value ="data")
public class Data implements Serializable {
    /**
     * 数据id
     */
    @TableId
    private Long id;

    /**
     *
     */
    private Long deviceId;

    /**
     *
     */
    private Long levelId;

    /**
     *
     */
    private LocalDateTime generateTime;

    /**
     * 酸碱度（无量纲）
     */
    private Double ph;

    /**
     * 氨氮
     */
    private Double nh;

    /**
     * 总磷
     */
    private Double tp;

    /**
     * 总氮
     */
    private Double tn;

    /**
     *
温度
     */
    private Double temp;

    /**
     * 溶解氧
     */
    private Double DO;

    /**
     * 高锰酸钾
     */
    private Double pp;

    /**
     * 电导率
     */
    private Double tds;

    /**
     * 浊度
     */
    private Double ftu;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Data other = (Data) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDeviceId() == null ? other.getDeviceId() == null : this.getDeviceId().equals(other.getDeviceId()))
            && (this.getLevelId() == null ? other.getLevelId() == null : this.getLevelId().equals(other.getLevelId()))
            && (this.getGenerateTime() == null ? other.getGenerateTime() == null : this.getGenerateTime().equals(other.getGenerateTime()))
            && (this.getPh() == null ? other.getPh() == null : this.getPh().equals(other.getPh()))
            && (this.getNh() == null ? other.getNh() == null : this.getNh().equals(other.getNh()))
            && (this.getTp() == null ? other.getTp() == null : this.getTp().equals(other.getTp()))
            && (this.getTn() == null ? other.getTn() == null : this.getTn().equals(other.getTn()))
            && (this.getTemp() == null ? other.getTemp() == null : this.getTemp().equals(other.getTemp()))
            && (this.getDO() == null ? other.getDO() == null : this.getDO().equals(other.getDO()))
            && (this.getPp() == null ? other.getPp() == null : this.getPp().equals(other.getPp()))
            && (this.getTds() == null ? other.getTds() == null : this.getTds().equals(other.getTds()))
            && (this.getFtu() == null ? other.getFtu() == null : this.getFtu().equals(other.getFtu()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode());
        result = prime * result + ((getLevelId() == null) ? 0 : getLevelId().hashCode());
        result = prime * result + ((getGenerateTime() == null) ? 0 : getGenerateTime().hashCode());
        result = prime * result + ((getPh() == null) ? 0 : getPh().hashCode());
        result = prime * result + ((getNh() == null) ? 0 : getNh().hashCode());
        result = prime * result + ((getTp() == null) ? 0 : getTp().hashCode());
        result = prime * result + ((getTn() == null) ? 0 : getTn().hashCode());
        result = prime * result + ((getTemp() == null) ? 0 : getTemp().hashCode());
        result = prime * result + ((getDO() == null) ? 0 : getDO().hashCode());
        result = prime * result + ((getPp() == null) ? 0 : getPp().hashCode());
        result = prime * result + ((getTds() == null) ? 0 : getTds().hashCode());
        result = prime * result + ((getFtu() == null) ? 0 : getFtu().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", deviceId=").append(deviceId);
        sb.append(", levelId=").append(levelId);
        sb.append(", generateTime=").append(generateTime);
        sb.append(", ph=").append(ph);
        sb.append(", nh=").append(nh);
        sb.append(", tp=").append(tp);
        sb.append(", tn=").append(tn);
        sb.append(", temp=").append(temp);
        sb.append(", dO=").append(DO);
        sb.append(", pp=").append(pp);
        sb.append(", tds=").append(tds);
        sb.append(", ftu=").append(ftu);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
